<?php

// uses varibles in db_settings.php, so db_settings.php has to be included first
// Database Stuff

$dbhost = $db_settings['host'];
$dbusername = $db_settings['user'];
$dbpasswd = $db_settings['password'];
$database_name = $db_settings['database'];

function connect_db($host,$user,$pw,$db)
 {
  global $lang;
  $connid = @mysql_connect($host, $user, $pw);
  @mysql_select_db($db, $connid);
  mysql_query("set names utf8");
  return $connid;
 }

/**
 * fetches settings from database 
 */ 
function get_settings()
 {
  global  $db_settings, $settings;
  $result = mysql_query("SELECT name, value FROM ".$db_settings['settings_table']);
  while ($line = mysql_fetch_array($result))
   {
    $settings[$line['name']] = stripslashes($line['value']);
   }
  mysql_free_result($result);
 }

connect_db($dbhost,$dbusername,$dbpasswd,$database_name);
if(mysql_error()==""){
	get_settings();
}

?>